<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./../template.xhtml">

            <ui:define name="title">
                Event Page
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <p:panel id="panel" header="UserDetail">
                        <p:panelGrid>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        User ID :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <h:outputText value="#{user.userID}" id="txtuserID" styleClass="art-blockcontent-body">
                                        </h:outputText>
                                    </h4>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        User Name :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText id="txtUsername" value="#{user.userName}" styleClass="art-blockcontent-body"
                                                     title="" required="true" maxlength="50"
                                             requiredMessage="User Name must not blank!."
                                             validatorMessage="Length of Full Name field must between 1-50 characters">
                                        </p:inputText>
                                    </h4>
                                </p:column>
                            </p:row>

                         
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Gender :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:selectOneRadio id="options" value="#{user.gender}" required="true"
                                                          requiredMessage="Gender must choose!">
                                            <f:selectItem itemLabel="Male" itemValue="true"/>
                                            <f:selectItem itemLabel="Female" itemValue="false" />
                                        </p:selectOneRadio>
                                    </h4>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        birthDay :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:calendar value="#{user.birthDay}" id="Birthday" navigator="true" effect="slideDown"
                                                     yearRange="c-40:c+20"
                                                     mindate="#{userController.minDobDate}" maxdate="#{userController.maxDobDate}" pattern="dd/MM/yyyy">
                                      <f:convertDateTime pattern="dd/MM/yyyy" />
                                        </p:calendar>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Email :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText value="#{user.email}" styleClass="art-blockcontent-body"
                                                     required="true" requiredMessage="Length of Email must not more 50 characters and Email must not Blank!"
                                                     validatorMessage="Email is not mach!" maxlength="50">
                                        <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
                                        </p:inputText>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Address :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputTextarea value="#{user.addressInfo}" autoResize="false"
                                                         styleClass="art-blockcontent-body" style="width: 180px" maxlength="200"
                                                         requiredMessage="Length of Email must not more 50 characters">
                                        </p:inputTextarea>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <h4 class="art-postheader">
                                        Phone Number :
                                    </h4>
                                </p:column>
                                <p:column>
                                    <h4 class="art-postheader">
                                        <p:inputText value="#{user.phoneNumber}" styleClass="art-blockcontent-body" maxlength="20" requiredMessage="Length of Phone number must not more 20 characters">
                                        </p:inputText>
                                    </h4>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <p:commandButton image="ui-icon ui-icon-pencil" action="#{userController.updateProfile}" value="Update" ajax="false" style="width: 80px; height: 30px"/>
                                </p:column>
                                <p:column>
                                    <p:commandButton value="Cancel" immediate="true" action="#{userController.cancelEditProfile}" style="width: 80px; height: 30px"/>
                                </p:column>
                            </p:row>
                        </p:panelGrid>
</p:panel>

                </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>
